<template>
  <div class="dashboard-editor-container">
    <panel-group :info="staticData"/>
    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <line-chart :chart-data="lineChartData"/>
    </el-row>
  </div>
</template>

<script>
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
import { getStatistics } from '@/api/system/index'

export default {
  name: 'Index',
  components: {
    PanelGroup,
    LineChart,
    RaddarChart,
    PieChart,
    BarChart
  },
  created() {
    this.getInfo()
  },
  data() {
    return {
      lineChartData: {
        expectedData: [],
        actualData: [],
        coachData: [],
        dateList: []
      },
      staticData: {}
    }
  },
  methods: {
    getInfo() {
      getStatistics().then(res => {
        this.staticData = res.data.statistic
        this.lineChartData.dateList = res.data.BeforeDateList
        this.lineChartData.expectedData = res.data.vipCount
        this.lineChartData.actualData = res.data.visitorCount
        this.lineChartData.coachData = res.data.coachCount
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
